//
// Created by gj on 16-2-2.
//

#include "com_base_util_jniutils_log_CLogConfig.h"

#include "log/CLog.h"

/*
 * Class:     com_base_util_jniutils_log_CLogConfig
 * Method:    NATIVE_GET_LOG_ON
 * Signature: ()Z
 */
JNIEXPORT jboolean JNICALL Java_com_base_util_jniutils_log_JniLogConfig_NATIVE_1GET_1LOG_1ON(JNIEnv *env, jclass clazz) {
    return CLogConfig::LOG_ON;
}

/*
 * Class:     com_base_util_jniutils_log_CLogConfig
 * Method:    NATIVE_SET_LOG_ON
 * Signature: (Z)V
 */
JNIEXPORT void JNICALL Java_com_base_util_jniutils_log_JniLogConfig_NATIVE_1SET_1LOG_1ON(JNIEnv *env, jclass clazz, jboolean logOn) {
    CLogConfig::LOG_ON = logOn;
}

/*
 * Class:     com_base_util_jniutils_log_CLogConfig
 * Method:    NATIVE_GET_LOG_ON_DEFAULT
 * Signature: ()Z
 */
JNIEXPORT jboolean JNICALL Java_com_base_util_jniutils_log_JniLogConfig_NATIVE_1GET_1LOG_1ON_1DEFAULT(JNIEnv *env, jclass clazz) {
    return CLogConfig::LOG_ON_DEFAULT;
}

/*
 * Class:     com_base_util_jniutils_log_CLogConfig
 * Method:    NATIVE_SET_LOG_ON_DEFAULT
 * Signature: (Z)V
 */
JNIEXPORT void JNICALL Java_com_base_util_jniutils_log_JniLogConfig_NATIVE_1SET_1LOG_1ON_1DEFAULT(JNIEnv *env, jclass clazz, jboolean logOnDefault) {
    CLogConfig::LOG_ON_DEFAULT = logOnDefault;
}

/*
 * Class:     com_base_util_jniutils_log_CLogConfig
 * Method:    NATIVE_GET_LOG_TAG_DEFAULT
 * Signature: ()Ljava/lang/String;
 */
JNIEXPORT jstring JNICALL Java_com_base_util_jniutils_log_JniLogConfig_NATIVE_1GET_1LOG_1TAG_1DEFAULT(JNIEnv *env, jclass clazz) {
    const char *logTag = CLogConfig::LOG_TAG_DEFAULT.c_str();
    return env->NewStringUTF(logTag);
}

/*
 * Class:     com_base_util_jniutils_log_CLogConfig
 * Method:    NATIVE_SET_LOG_TAG_DEFAULT
 * Signature: (Ljava/lang/String;)V
 */
JNIEXPORT void JNICALL Java_com_base_util_jniutils_log_JniLogConfig_NATIVE_1SET_1LOG_1TAG_1DEFAULT(JNIEnv *env, jclass clazz, jstring logTagDefault) {
    const char *logTag = env->GetStringUTFChars(logTagDefault, NULL);
    CLogConfig::LOG_TAG_DEFAULT = logTag;
    env->ReleaseStringUTFChars(logTagDefault, logTag);
}


/*
 * Class:     com_base_util_jniutils_log_CLogConfig
 * Method:    NATIVE_UNIT_TESTING
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_com_base_util_jniutils_log_JniLogConfig_NATIVE_1UNIT_1TESTING(JNIEnv *env, jclass clazz) {
#ifdef FLAG_UNIT_TESTING
    log_unit_testing();
#endif
}

